﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.DialogUI {
    import Engine.Managers.*;
    import flash.display.*;
    import Events.*;
    import flash.utils.*;
    import org.aswing.*;
    import org.aswing.border.*;
    import Display.aswingui.*;
    import Modules.stats.types.*;

    public class ComboEnergyDialogView extends GenericDialogView {

        private var m_buyCallback:Function;
        private var m_askCallback:Function;

        public function ComboEnergyDialogView(_arg1:Dictionary, _arg2:Function=null, _arg3:Function=null, _arg4:Function=null){
            super(_arg1);
            this.m_buyCallback = _arg2;
            this.m_askCallback = _arg3;
            m_closeCallback = _arg4;
        }
        override protected function createInteriorHolder():JPanel{
            var _local1:JPanel;
            var _local3:JPanel;
            var _local8:JPanel;
            _local1 = new JPanel(new SoftBoxLayout(SoftBoxLayout.Y_AXIS, -25, SoftBoxLayout.TOP));
            _local1.setPreferredWidth(m_bgAsset.width);
            _local1.setMinimumWidth(m_bgAsset.width);
            _local1.setMaximumWidth(m_bgAsset.width);
            m_titleString = "OutOfEnergyVisitMarket";
            m_message = ZLoc.t("Dialogs", "OutOfEnergyComboMessage");
            var _local2:JPanel = createHeaderPanel();
            ASwingHelper.prepare(_local2);
            _local3 = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.CENTER, 0);
            var _local4:JPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.BOTTOM);
            var _local5:JPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.BOTTOM);
            var _local6:DisplayObject = m_assetDict["energyDialog_energyGuy"];
            var _local7:AssetPane = new AssetPane(_local6);
            ASwingHelper.setSizedBackground(_local5, _local6);
            _local4.append(_local5);
            ASwingHelper.setEasyBorder(_local4, 0, 0);
            textArea = createTextArea();
            ASwingHelper.prepare(textArea);
            _local3.appendAll(_local4, textArea);
            _local1.setBorder(new EmptyBorder(null, new Insets(0, 0, 0, 0)));
            _local1.append(_local2);
            _local1.append(_local3);
            _local3.mouseChildren = (_local3.mouseEnabled = false);
            if (m_type != TYPE_MODAL){
                _local8 = this.createButtonPanel();
                _local1.append(_local8);
            };
            ASwingHelper.prepare(_local1);
            return (_local1);
        }
        override protected function setMessageTextWidth(_arg1:Boolean=false):Number{
            var _local2:Number = 284;
            return (_local2);
        }
        override protected function createButtonPanel():JPanel{
            var _local1:JPanel = new JPanel(new FlowLayout(AsWingConstants.CENTER));
            var _local2:CustomButton = new CustomButton(ZLoc.t("Dialogs", "GetNow"), null, "GreenButtonUI");
            var _local3:CustomButton = new CustomButton(ZLoc.t("Dialogs", "AskFriends"), null, "GreenButtonUI");
            _local2.addActionListener(this.closeWithBuy, 0, true);
            _local3.addActionListener(this.closeWithAsk, 0, true);
            _local1.appendAll(_local2, _local3);
            return (_local1);
        }
        protected function closeWithBuy(_arg1):void{
            countDialogViewAction("GetNow");
            StatsManager.count(StatsCounterType.PROMPTS, StatsKingdomType.OUT_OF_ENERGY, StatsPhylumType.ENERGY_COMBO_ENABLED, "buyenergy");
            this.m_buyCallback(null);
            this.m_buyCallback = null;
            this.m_askCallback = null;
            m_closeCallback = null;
            closeMe();
        }
        protected function closeWithAsk(_arg1):void{
            countDialogViewAction("AskFriends");
            this.m_askCallback(new GenericPopupEvent(GenericPopupEvent.SELECTED, YES_NOMARKET, true));
            StatsManager.count(StatsCounterType.PROMPTS, StatsKingdomType.OUT_OF_ENERGY, StatsPhylumType.ENERGY_COMBO_ENABLED, "askfriends");
            this.m_buyCallback = null;
            this.m_askCallback = null;
            m_closeCallback = null;
            closeMe();
        }
        override protected function onCancel(_arg1):void{
            countDialogViewAction("X");
            StatsManager.count(StatsCounterType.PROMPTS, StatsKingdomType.OUT_OF_ENERGY, StatsPhylumType.ENERGY_COMBO_ENABLED, "closed");
            this.m_buyCallback = null;
            this.m_askCallback = null;
            m_closeCallback = null;
            closeMe();
        }

    }
}//package Display.DialogUI 
